package edu.tju.belongings;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;


public class IbatisBelongingsDao implements IBelongingsDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();

	

	
	public void deleteBelongings(long id) throws SQLException {
		sqlMap.delete("deleteBelongings", id);
		
	}

	public List<Belongings> getBelongingsAnd(Belongings belongings)
			throws SQLException {
		 
		return sqlMap.queryForList("getBelongingsAnd", belongings);
	}

	
	public Belongings getBelongingsById(long id) throws SQLException {
		 
		return (Belongings) sqlMap.queryForObject("getBelongingsById", id);
	}

	public List<Belongings> getBelongingsOr(Belongings belongings)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Long insertBelongings(Belongings belongings) throws SQLException {
	 
		return (Long)sqlMap.insert("insertBelongings", belongings);
	}

	
	public int updateBelongings(Belongings belongings) throws SQLException {
		 
		return sqlMap.update("updateBelongings", belongings);
	}

}
